< previous page page_753 next page >

Page 753
Although the StateChanged event contains the main portion of code for this sample program, you still need to add code to the Click event of cmdRetrieve to initiate the request. The code in Listing 33.4, uses the Execute method of the Internet Transfer control to issue an HTTP command.
Listing 33.4 INETDEMO.ZIPThe Execute Method
Private Sub cmdRetrieve_Click()
    
    Inet1.protocol = icHTTP
    Inet1.Execute CStr(txtURL), "GET /"

    While Inet1.StillExecuting
        DoEvents
    Wend
    
    MsgBox "Done!"
    
End Sub
After entering the code in Listing 33.4, run the program and enter a test URL in the text box. Click the button and the HTML should be displayed on the form, as shown in Figure 33.6.
0753-01.jpg
Figure 33.6
The Internet Transfer control can be
used to retrieve HTML from a Web site.
In our sample program, we just printed the results on the form. To work with the HTML as a string, you need to store it in a string variable or label control. When the download is complete, you can easily search the HTML for the information you want using standard string functions.
Transferring Files
FTP, the Internet's File Transfer Protocol, has been around a lot longer than the World Wide Web. As with the Web, FTP involves both a client and a server machine. Although in recent years FTP clients have become graphical, the standard implementation of the FTP client is text based, like the one shown in Figure 33.7.

 
< previous page page_753 next page >